<?php

/**
 * Файл формирования маршрутов.
 * Происходит инициализация объекта маршрутизации
 * и задание правил маршрутизации
 *
 * @author Игорь Будасов aka Lord <igor.budasov@gmail.com>
 */

$router = new Zend_Controller_Router_Rewrite();

$router->addRoute('profile',
	 new Zend_Controller_Router_Route('user/profile/index/id/:id', array('module'     => 'user',
														'controller' => 'profile',
														'action'     => 'index'))
);
// маршрут для страниц. Для одной страницы
$router->addRoute('page',
	 new Zend_Controller_Router_Route('page/:url', array('module'      => 'pages',
														  'controller' => 'page',
														  'action'     => 'index'))
);
// маршрут для страницы товаров
$router->addRoute('good',
	 new Zend_Controller_Router_Route('good/:url', array('module'      => 'store',
														  'controller' => 'goods',
														  'action'     => 'view'))
);        
// маршрут для категории
   /*
$router->addRoute('category', new Zend_Controller_Router_Route('category/:category_url', array('module' => 'store', 'controller' => 'goods', 'action' => 'index')));
$router->addRoute('category_sort', new Zend_Controller_Router_Route('category/:category_url/sort/:sort', array('module' => 'store', 'controller' => 'goods', 'action' => 'index')));
$router->addRoute('category_sort_manufacturer', new Zend_Controller_Router_Route('category/:category_url/sort/:sort/manufacturer/:manufacturer', array('module' => 'store', 'controller' => 'goods', 'action' => 'index')));
         
$request = $_SERVER['REQUEST_URI'];
$page = (stripos($request,'page'))
      ? '/page/:page'
      : '/page/1';
$category = (stripos($request,'category'))
      ? '/category/:category_url'
      : '';
$sort = (stripos($request,'sort'))
      ? '/sort/:sort'
      : '';
$manufacturer = (stripos($request,'manufacturer'))
      ? '/manufacturer/:manufacturer'
      : '';
$route = $category.$sort.$manufacturer.$page;
 
if(!empty($sort) or !empty($category) or !empty($manufacturer) or !empty($page))        
$router->addRoute('category_sort_manufacturer_page', 
    new Zend_Controller_Router_Route($route, 
                                     array('module' => 'store', 
                                           'controller' => 'goods', 
                                           'action' => 'index'))); 
 */

   



